<?php
declare (strict_types = 1);
namespace app\course\model\classes;

use app\common\model\BaseModel;
use app\course\model\base\admin\Course;
use think\model\relation\BelongsTo;

/**
 * 班级课程-关联课程--后台管理
 */
class ClassesLink extends BaseModel
{
    protected $name = 'course_classes_link';

    /**
     * 定义字段类型
     * @var array
     */
    protected $type = [
        'id'          => 'integer',
        'classes_id'  => 'integer',
        'course_id'   => 'integer',
        'create_time' => 'integer',
    ];

    /**
     * 关联课程
     * Author   Martinsun<syh@sunyonghong.com>
     * Date 2020-06-29
     */
    public function course(): BelongsTo
    {
        return $this->belongsTo(Course::class, 'course_id')->bind(['course_type','course_type_text','title', 'teacher_id', 'section_level']);
    }

    /**
     * 关联课程标题
     * Author: 亓官雨树 <lucky.max@foxmail.com>
     * Date: 23/01/05
     *
     * @return BelongsTo
     */
    public function courseTitle(): BelongsTo
    {
        return $this->belongsTo(Course::class, 'course_id')->bind(['title']);
    }



}
